#!/bin/bash
# @hequan
# 重启淘宝渠道队列


workdir="/trunk/src/channeladmin/cron_scripts/taobao_queue"

cd ${workdir}

php bin/monitor.php stop

sleep 1

num=`ps -ef|grep "taobao_queue"|grep -v grep|wc -l`
if [ ${num} -ne 0 ] ; then
	pids=`ps -ef|grep taobao_queue|grep -v grep|awk '{printf("%s ",$2);}'`
	kill ${pids}
	sleep 5
	num=`ps -ef|grep "taobao_queue"|grep -v grep|wc -l`
	if [ ${num} -ne 0 ] ; then
		sleep 10
		pids=`ps -ef|grep taobao_queue|grep -v grep|awk '{printf("%s ",$2);}'`
		kill -9 ${pids}
	fi
fi

cd ${workdir}
nohup php bin/monitor.php 
